package com.atguigu.spring.aop.proxy.statics;

/**
 * @author wk
 * @create 2021-06-03 15:54
 * 代理对象
 */
public class CalculateProxy implements Calculate {

    private CalculateImpl calculateImpl;

    public CalculateProxy(CalculateImpl calculateImpl) {
        this.calculateImpl = calculateImpl;
    }

    @Override
    public int add(int i, int j) {
        System.out.println("Logger-->方法名，add,参数"+i+","+j);
        int result = calculateImpl.add(i, j);
        System.out.println("Logger-->方法名，add,结果"+result);
        return result;
    }

    @Override
    public int sub(int i, int j) {
        System.out.println("Logger-->方法名，sub,参数"+i+","+j);
        int result = calculateImpl.sub(i, j);
        System.out.println("Logger-->方法名，sub,结果"+result);
        return result;
    }

    @Override
    public int mul(int i, int j) {
        System.out.println("Logger-->方法名，mul,参数"+i+","+j);
        int result = calculateImpl.mul(i, j);
        System.out.println("Logger-->方法名，mul,结果"+result);
        return result;
    }

    @Override
    public int div(int i, int j) {
        System.out.println("Logger-->方法名，div,参数"+i+","+j);
        int result = calculateImpl.div(i, j);
        System.out.println("Logger-->方法名，div,结果"+result);
        return result;
    }
}
